[seismology] Add DepthLookup abstract interface#199
Conversation
|
I am not in favour of the name |
Yeah you are right. Which one you prefer me to go with? |
|
Just thinking, if we already have a class doing a similar thing ... |
051c31b to
744ed10
Compare
Adds an extensible depth-lookup interface used by scautoloc and other processing modules to select region- or slab-specific default and maximum depths instead of a single global value. Two built-in implementations: "Constant" (passthrough) and "Polygon" (named GeoFeatureSet regions with defaultDepth/maxDepth attributes). Third-party backends register via REGISTER_DEPTH_LOOKUP in a plugin.
Rename getDefaultDepth/getMaxDepth → fetch/fetchMaxDepth; remove caller-supplied fallback parameter. Each backend now owns its full depth knowledge including fallback via its own config namespace: depths.constant.value, depths.polygon.regions, depths.polygon.fallback.
Per Jan's review: fetch() and fetchMaxDepth() now throw std::out_of_range when no region/zone contains the given location. Callers that need a fallback value use the utility functions fetchDepth() and fetchMaxDepth() which catch and return the fallback. Removes the fallback ownership from DepthLookupPolygon — callers decide what to do when outside all configured regions.
a886635 to
eff40d7
Compare
|
Addressed Jan's review feedback:
|
|
Do we have the possibility to retrieve more than one depth? I am referring to the situation where there is deep seismicity along a subducting slab, but also shallow seismicity right above it. That separation can be significant and we need to be careful not to trust a potentially wrong depth. |
|
Thank you for the changes. What I still do not like very much are the utility functions. I proposed that initially to provide a fallback rather than incorporating it into the fetch methods. The better design worked out later was that the client ( |
Good point , the current interface only returns a single depth. Are you thinking the interface should return a list of candidate depths for scautoloc to try, or more that scautoloc itself should decide to try both a shallow and a slab-based seed independently? |
Understood, fetch() should always return a value, with the fallback knowledge fully encapsulated in the backend. The client should never need to handle an exception or supply a depth. Will remove the utility functions and have each backend return its own configured fallback when no zone matches. |
|
Why do I have the feeling chatting with Claude AI rather than yourself? ;) |
|
Not really. :) 80% is me, at least.
…On Thu, Jun 4, 2026 at 11:49 PM Jan Becker ***@***.***> wrote:
*gempa-jabe* left a comment (SeisComP/common#199)
<#199 (comment)>
Why do I have the feeling chatting with Claude AI rather than you? ;)
—
Reply to this email directly, view it on GitHub
<#199?email_source=notifications&email_token=ACB5ZSHDHEJRN5WNYALOTCL46F447A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINRSGI3TIOBWHEZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4622748692>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACB5ZSBGNTY4IIJAOGUQ73346F447AVCNFSM6AAAAACZGZO4TSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DMMRSG42DQNRZGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Kind regards
Mustafa
|
Reworked based on Jan's feedback: fetch() and fetchMaxDepth() always return a value, fallback is configured inside the backend. Removed the utility functions that required the client to supply a fallback.
Done, removed the utility functions and the fallback is back where it belongs, inside the backend. fetch() and fetchMaxDepth() always return a value now, the client doesn't know or care about fallbacks. |
Summary
Introduces an abstract
DepthLookupinterface for region- and slab-baseddepth lookup in SeisComP processing modules (primarily scautoloc).
Interface (
libs/seiscomp/seismology/depthlookup.h):Each backend owns all depth knowledge including fallback; no fallback
parameter on the caller side.
Two built-in backends (
depthlookup.cpp):"Constant"— returnsdepths.constant.valuefor any location"Polygon"— queries GeoFeatureSet polygons (each must carry adefaultDepthattribute); fallback fromdepths.polygon.fallback;regions listed in
depths.polygon.regionsA third
"Slab2"backend ships in SeisComP/main as thedlslab2plugin (see SeisComP/main#121).
Test plan
seiscomp_core— clean compile, no errorsDepthLookupConstantreturnsdepths.constant.valueDepthLookupPolygonreturns polygon depth inside region, fallback outside